// ----------------------------------
// RSDK Project: Sonic 1/Sonic 2
// Script Description: Pink Block Object
// Script Author: Christian Whitehead/Simon Thomley
// Unpacked by Rubberduckycooly's script unpacker
// ----------------------------------

//-------Aliases-------//
private alias 6 : TYPE_PINKBLOCK

// Function declarations
reserve function PinkBlock_DebugDraw
reserve function PinkBlock_DebugSpawn

// Static Values

// Tables

function PinkBlock_DebugDraw
	DrawSprite(0)
	DrawSprite(1)
	DrawSprite(2)
end function


function PinkBlock_DebugSpawn
	temp5 = 6
	temp4 = 0
	CallFunction(DebugMode_SpawnObject)
	object[arrayPos0].drawOrder = 4
	object[arrayPos0].groupID = GROUP_BLOCKS
end function


event ObjectMain
	foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)
		CallFunction(SpecialSetup_Function10)
	next
end event


event ObjectDraw
	if object.propertyValue > 0
		temp0 = SpecialSetup_value12
		temp0 >>= 3
		temp1 = object.propertyValue
		temp1 -= temp0
		switch temp1
		case 1
		case 3
			object.type = TypeName[Yellow Block]
		end switch
	end if
	CallFunction(SpecialSetup_Function9)
	DrawSpriteFX(0, FX_ROTATE, temp0, temp1)
	DrawSpriteXY(1, temp0, temp1)
	temp2 = object.rotation
	temp2 >>= 3
	temp2 += 2
	DrawSpriteFX(temp2, FX_ROTATE, temp0, temp1)
	object.type = TypeName[Pink Block]
end event


event ObjectStartup
	LoadSpriteSheet("Special/Objects.gif")
	SpriteFrame(-12, -12, 24, 24, 126, 276)
	SpriteFrame(-10, -8, 20, 16, 151, 276)
	temp0 = 1
	temp1 = 201
	while temp1 < 300
		temp0 = 1
		while temp0 < 500
			SpriteFrame(-12, -12, 24, 24, temp0, temp1)
			temp0 += 25
		loop
		temp1 += 25
	loop
	foreach (TypeName[Pink Block], arrayPos0, ALL_ENTITIES)
		object[arrayPos0].groupID = GROUP_BLOCKS
	next
	SetTableValue(TypeName[Pink Block], DebugMode_ObjCount, DebugMode_TypeTable)
	SetTableValue(PinkBlock_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)
	SetTableValue(PinkBlock_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)
	DebugMode_ObjCount++
end event

event RSDKDraw
	DrawSprite(0)
	DrawSprite(1)
	DrawSprite(2)
end event

event RSDKLoad
	LoadSpriteSheet("Special/Objects.gif")
	SpriteFrame(-12, -12, 24, 24, 126, 276)
	SpriteFrame(-10, -8, 20, 16, 151, 276)
	SpriteFrame(-12, -12, 24, 24, 1, 201)
end event
